<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>vue3双向数据绑定</title>
</head>
<body>
  <div id="app"></div>
  <button id="btn">click</button>
  <script src="./index.js"></script>
  <script>
    const app = document.querySelector('#app')
    const button = document.querySelector('#btn')

    const introduce = {
      name: 'Alan',
      age: 4
    }
    const obj = reactive(introduce)
    const double = computed(() => obj.age*2)
    effect(() => {
      app.innerHTML = `
      <h1>${obj.name}今年${obj.age}岁了, ${double.value}</h1>
      `
    })
    // false 事件不能穿透
    btn.addEventListener('click', () => {
      obj.age += 1
    }, false);
    
  </script>
</body>
</html>